package com.pym.bs.utils;

import com.pym.bs.enums.ResultEnum;
import com.pym.bs.vo.ResultVO;

public class ResultVOUtils {

    public static ResultVO success(Object data) {
        ResultVO resultVO = new ResultVO();
        resultVO.setData(data);
        resultVO.setStatus(ResultEnum.OK.getStatus());
        resultVO.setMessage(ResultEnum.OK.getMessage());
        return resultVO;
    }

    public static ResultVO success() {
        return success(null);
    }

    public static ResultVO error(ResultEnum resultEnum) {
        return error(resultEnum, resultEnum.getMessage());
    }

    public static ResultVO error(ResultEnum resultEnum, String message) {
        ResultVO resultVO = new ResultVO();
        resultVO.setStatus(resultEnum.getStatus());
        resultVO.setMessage(message);
        return resultVO;
    }

}
